﻿/*
* @Author： whg
* @Date : 2021-1-19
* @Desc : 
*/
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using XNode;
 //[NodeTint("#000000")]
public class StoryVoNode : BaseNode 
{
     [Output(backingValue = ShowBackingValue.Always)]
     public BaseNode downLink;
     public override StringBuilder ToTable()
    {
        StringBuilder result = new StringBuilder(1024);
        result.Append("			type = Config.StoryType." + storyType + ",\n");
         if(SetTimes)
         {
             result.Append("			times = " + times + ",\n");
         }
         if (SetTotalTime && totalTime > 0)
         {
             result.Append("			totalTime = " + totalTime + ",\n");
         }
         if (SetTimeOut && timeout > 0)
         {
             result.Append("			timeout = " + timeout + ",\n");
         }
         if (storyType == StoryType.Dungeon && dungeon_id > 0)
         {
             result.Append("			dungeon_id = " + dungeon_id + ",\n");
         }
         if (preload!="")
             result.Append("			preload = {" + preload + "},\n");
        return result;
    }
     public int index = -1;
    public enum StoryType { Normal = 0, MainTask, Dungeon, Preload }
    [Tooltip("Normal开场的剧情,MainTask主线剧情,Dungeon副本剧情,Preload需要预先加载")]
    public StoryType storyType = StoryType.Normal;
    [Tooltip("预处理的剧情针对无缝剧情过渡的， 标记为预处理剧情，则可以播放多次")]
    public bool Precondition = false;
    [Tooltip("(选填)播放次数。不填或为-1时，为不做限制")]
    public bool SetTimes = false;
    public float times;
    [Tooltip("(选填)需要服务端验证的主线剧情,以及需要快进的剧情必填,其他情况可不填.")]
    public bool SetTotalTime = false;
    public float totalTime;
    [Tooltip("(选填)播放超时时间（超过这个时间跳过当前剧情）")]
    public bool SetTimeOut = false;
    public float timeout;
    [Tooltip("副本类型剧情填写")]
    public int dungeon_id = -1;
    [Tooltip("需要预加载的剧情索引")]
    public string preload = "";
    protected override void Init()
    {
        base.Init();
        index = index == -1 ? GetStoryIndex() : index;
        dungeon_id = GetStoryID(graph.name);
    }
}
